package com.appwoo.txtws.activity;

import android.app.ProgressDialog;
import android.content.pm.PackageManager;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.appwoo.txtws.adapter.ListViewCreator;
import com.appwoo.txtws.adapter.Page;
import com.appwoo.txtws.adapter.SimpleListAdapter;
import com.appwoo.txtws.app.App;
import com.appwoo.txtws.app.AppActivity;
import com.appwoo.txtws.bean.SoftTypeMarketBean;
import com.appwoo.txtws.component.Global;
import com.appwoo.txtws.service.SoftTypeMarkeServer;
import com.appwoo.txtws.wheel.widget.PageListView;
import com.appwoo.txtws.wheel.widget.PageListView.OnRefreshListener;
import java.util.List;

public class SoftTypeForChildActivity extends AppActivity
{
  private SimpleListAdapter<SoftTypeMarketBean> adapter;
  private List<SoftTypeMarketBean> appInfos;
  private ProgressDialog dialog = null;
  private List<SoftTypeMarketBean> events;
  private Boolean isFoot = Boolean.valueOf(false);
  private Boolean isSDCard = Boolean.valueOf(false);
  private LinearLayout llEmpty;
  private PageListView lvList;
  private Page<SoftTypeMarketBean> page = new Page();
  private PackageManager pm;
  private TextView tvEmpty;

  private void initView()
  {
    this.isSDCard = Boolean.valueOf(Global.isSDCard());
    this.pm = getPackageManager();
    this.lvList = ((PageListView)findViewById(2131492985));
    this.llEmpty = ((LinearLayout)findViewById(2131493266));
    this.tvEmpty = ((TextView)findViewById(2131493267));
    if (!isNetworkAvailable(this))
    {
      this.llEmpty.setVisibility(0);
      this.tvEmpty.setText(getString(2131427553));
      this.lvList.setVisibility(8);
      return;
    }
    this.adapter = new SimpleListAdapter(this.page.getEntries(), new ListViewCreator()
    {
      public View createView(final SoftTypeMarketBean paramAnonymousSoftTypeMarketBean, View paramAnonymousView, int paramAnonymousInt)
      {
        if (paramAnonymousView == null)
          paramAnonymousView = App.getLayoutInflater().inflate(2130903130, null);
        ((TextView)paramAnonymousView.findViewById(2131493155)).setText(paramAnonymousSoftTypeMarketBean.getTypeName());
        ((TextView)paramAnonymousView.findViewById(2131493158)).setText(paramAnonymousSoftTypeMarketBean.getSoftCount() + "个应用");
        ImageView localImageView = (ImageView)paramAnonymousView.findViewById(2131493154);
        SoftTypeForChildActivity.this.loadLogoImage(localImageView, paramAnonymousSoftTypeMarketBean.getTypeIcon(), SoftTypeForChildActivity.this.isSDCard);
        paramAnonymousView.setOnClickListener(new View.OnClickListener()
        {
          public void onClick(View paramAnonymous2View)
          {
            Bundle localBundle = new Bundle();
            localBundle.putString("TypeID", paramAnonymousSoftTypeMarketBean.getTypeID());
            localBundle.putString("TypeName", paramAnonymousSoftTypeMarketBean.getTypeName());
            SoftTypeForChildActivity.this.IntentActivity(SoftTypeForChildActivity.this, AppByTypeForChildActivity.class, localBundle);
          }
        });
        return paramAnonymousView;
      }
    });
    this.lvList.setAdapter(this.adapter);
    this.lvList.setOnLoadMoreListener(new PageListView.OnRefreshListener()
    {
      public void onRefresh()
      {
        SoftTypeForChildActivity.this.isFoot = Boolean.valueOf(true);
        SoftTypeForChildActivity.this.loadingData(true);
      }
    });
    addOperation(new DataTask().execute(new String[] { "installindex" }));
  }

  private void loadingData(boolean paramBoolean)
  {
    if (paramBoolean)
      this.page.firstPage();
    while (true)
    {
      addOperation(new DataTask().execute(new String[] { "installindex" }));
      return;
      this.page.nextPage();
    }
  }

  protected void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    setContentView(2130903160);
    initView();
  }

  protected void onResume()
  {
    super.onResume();
  }

  class DataTask extends AsyncTask<String, Integer, String>
  {
    String param;

    DataTask()
    {
    }

    protected String doInBackground(String[] paramArrayOfString)
    {
      this.param = paramArrayOfString[0];
      if (this.param.equals("installindex"))
        SoftTypeForChildActivity.this.events = new SoftTypeMarkeServer(SoftTypeForChildActivity.this, SoftTypeForChildActivity.this.page.getPageNo(), 100).getSoftType();
      return null;
    }

    protected void onPostExecute(String paramString)
    {
      if (this.param.equals("installindex"))
      {
        if ((SoftTypeForChildActivity.this.events == null) || (SoftTypeForChildActivity.this.events.size() <= 0))
          break label122;
        SoftTypeForChildActivity.this.page.addAllEntries(SoftTypeForChildActivity.this.events);
        SoftTypeForChildActivity.this.adapter.notifyDataSetChanged();
        SoftTypeForChildActivity.this.lvList.onLoadMoreComplete();
        SoftTypeForChildActivity.this.lvList.hideFotterMoreView();
        SoftTypeForChildActivity.this.events.clear();
      }
      while (true)
      {
        if (!SoftTypeForChildActivity.this.isFoot.booleanValue())
          SoftTypeForChildActivity.this.closeProgress();
        super.onPostExecute(paramString);
        return;
        label122: SoftTypeForChildActivity.this.lvList.hideFotterMoreView();
        SoftTypeForChildActivity.this.alertMessage("没有更多数据");
      }
    }

    protected void onPreExecute()
    {
      if (!SoftTypeForChildActivity.this.isFoot.booleanValue())
        SoftTypeForChildActivity.this.showProgress("");
      super.onPreExecute();
    }
  }
}

/* Location:           C:\Documents and Settings\Administrator\classes_dex2jar.jar
 * Qualified Name:     com.appwoo.txtws.activity.SoftTypeForChildActivity
 * JD-Core Version:    0.6.2
 */